package com.nan.hrm.doc;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * 针对于  course 表的文档映射
 * indexName：索引库
 * type：类型(表类型)
 */
@Document(indexName = "hrm" , type = "course")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseDoc {
    //对应文档的id  PUT  /index/type/id
    @Id
    private Long id;

    @Field(index = true,type = FieldType.Text)
    private String name;
    @Field(index = false,type = FieldType.Keyword)
    private String forUser;
    @Field(index = false,type = FieldType.Keyword)
    private String gradeName;
    @Field(index = false,type = FieldType.Keyword)
    private String tenantName;
    @Field(index = true,type = FieldType.Date)
    private Date startTime;
    @Field(index = false,type = FieldType.Keyword)
    private String pic;
    @Field(index = true,type = FieldType.Integer)
    private Integer saleCount;
    @Field(index = true,type = FieldType.Integer)
    private Integer viewCount;
    @Field(index = true,type = FieldType.Integer)
    private Integer commentCount;
    @Field(index = true,type = FieldType.Float)
    private Float price;
}
